

package CtrLayer;
import ModelLayer.*;
import DBLayer.*;

import java.util.ArrayList;

public class CustomerCtr {
   
    
    /** Creates a new instance of CustomerCtr */
    public CustomerCtr() {
        
    }
    public ArrayList<Customer> findAllCustomers()
    {
      IFDBCustomer dbCustomer = new DBCustomer();
      ArrayList<Customer> allCustomers = new ArrayList<Customer>();
      allCustomers = dbCustomer.getAllCustomers(false);
      return allCustomers;
    }
    public Customer findByName(String name)
    {
        IFDBCustomer dbCustomer = new DBCustomer();
        return dbCustomer.searchCustomerName(name, true);
    }
   
      public Customer findByCustomerID(int CustomerID)
    {
        IFDBCustomer dbCustomer = new DBCustomer();
        return dbCustomer.searchCustomerID( CustomerID, true);
    }
      public int updateCustomer(int customerID, String name, String cAddress, int zipcode, String city, int phoneNo)
      {
          IFDBCustomer dbCustomer = new DBCustomer();
          Customer cus = new Customer();
          cus.setCustomerID(customerID);
          cus.setName(name);
          cus.setcAddress(cAddress);
          cus.setZipCode(zipcode);
          cus.setCity(city);
          cus.setPhoneNo(phoneNo);
          return  dbCustomer.updateCustomer(cus);
          
          
      }
      
      
    
}